<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                >

    <f:subview id="provaHistoricoEmbutido" rendered="#{fluxoExibicaoProva.exibirProvaHistorico}">
        <h:panelGrid columns="1" id="embProvaCriar" width="850" styleClass="center" rendered="#{provaCriacaoManager.provaPendente}">
            <h:form styleClass="center" style="margin-left: 50px;">
                <p:commandLink actionListener="#{fluxoExibicaoProva.metodoExibirProvaResponde}" 
                               immediate="true" update="conteudoCentralGroup,messages">
                    <h:panelGrid columns="2">
                        <h:graphicImage library="img" name="prova_24.png" title="#{msg.titleprovaPendente}"/>
                        <h:outputText value="#{msg.provaPendente}" styleClass="blue" title="#{msg.titleprovaPendente}"/>
                    </h:panelGrid>
                </p:commandLink>
            </h:form>
        </h:panelGrid>
        <h:panelGrid columns="1" id="embProvaHistorico" width="850" styleClass="center" rendered="#{!provaCriacaoManager.provaPendente}">
            <h:form id="dataForm">  
                <p:dataTable var="prova" value="#{provaResponderManager.historicoProvas}"
                             id="provasHistorico" rows="3" paginator="true" 
                             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks}
                             {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  styleClass="bvb-font"
                             rowsPerPageTemplate="3,5,8" emptyMessage="#{msg.semRegistrosEcontrados}">  
                    <f:facet name="header">
                        <h:outputText value="#{msg.richTableHistoricoQuestoes}"/>
                    </f:facet>

                    <p:column id="col1" styleClass="center">  
                        <f:facet name="header">  
                            <h:outputText value="#{msg.certificacao}"/>
                        </f:facet>  
                        <h:outputText value="#{prova.certificacao}" />  
                    </p:column>  

                    <p:column id="col2"  filterBy="#{prova.versaoNome}" headerText="Model" footerText="contains"
                              filterMatchMode="contains" styleClass="center">  
                        <f:facet name="header">  
                            <h:outputText value="#{msg.versao}"/>
                        </f:facet>  
                        <h:outputText value="#{prova.versaoNome}" />  
                    </p:column>  

                    <p:column id="col3" styleClass="center">  
                        <f:facet name="header">  
                            <h:outputText value="#{msg.mediaCobrada}"/>
                        </f:facet>  
                        <h:outputText value="#{prova.notaParaPassar /100}" >
                            <f:convertNumber minFractionDigits="2" maxFractionDigits="2" type="percent"/>
                        </h:outputText>  
                    </p:column>

                    <p:column id="col4" styleClass="center">  
                        <f:facet name="header">  
                            <h:outputText value="#{msg.notaAlcancada}"/>
                        </f:facet>  
                        <h:outputText value="#{prova.notaTirada /100}" >
                            <f:convertNumber type="percent" minFractionDigits="2" maxFractionDigits="2"/>
                        </h:outputText>  
                    </p:column>

                    <p:column id="col5" styleClass="center" >  
                        <f:facet name="header">  
                            <h:outputText value="#{msg.data}"/>
                        </f:facet>  
                        <h:outputText value="#{prova.dataCriacao}" >
                            <f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="#{initParam['timezone']}"/>
                        </h:outputText>  
                    </p:column>

                    <p:column id="responderProva" styleClass="center">
                        <f:facet name="header">
                            <h:outputText value="#{msg.richColumnComentada}"/>
                        </f:facet>
                        <p:commandButton update="conteudoCentralGroup,messages" image="provaComentada"
                                         title="#{msg.titleProvaCarregarProvaHistorico}" id="buttonProva">
                            <f:setPropertyActionListener value="#{prova}" target="#{provaResponderManager.prova}" />  
                        </p:commandButton>
                    </p:column>

                    <p:column id="analisarProva" styleClass="center">
                        <f:facet name="header">
                            <h:outputText value="#{msg.richColumnDesempenho}"/>
                        </f:facet>
                        <p:commandButton update="conteudoCentralGroup" image="ui-icon provaChart"
                                         rendered="#{100 > prova.notaTirada and prova.multiplaVersao}"
                                         title="#{msg.titleProvaCarregarProvaDesempenho}" id="buttonAnalise">
                            <f:setPropertyActionListener value="#{prova}" target="#{provaReportManager.provaTerminada}" />  
                        </p:commandButton>
                    </p:column>
                </p:dataTable>  
            </h:form>  

            <p:spacer width="100%" height="15"/>

            <p:pieChart value="#{provaReportManager.pieModel}" style="width:100%;height:400px" 
                        title="#{msg.pieErroPorTotalErros}" legendPosition="w" 
                        rendered="#{provaReportManager.provaTerminada != null}"/>

            <p:barChart value="#{provaReportManager.categoryModel}" legendPosition="ne" style="width:100%;height:400px"  
                        rendered="#{provaReportManager.provaTerminada != null}"  seriesColors="4bb2c5,FD0729"
                        title="#{msg.barraErroPorTotalQuestoesObjetivo}" min="0" max="#{provaReportManager.tamanhoDasBarras}"/>  
        </h:panelGrid>

    </f:subview>
</ui:composition>
